package com.yaodian100.ec.timelimitsale.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.yaodian100.core.common.entity.BaseEntity;
import com.yaodian100.ec.product.entity.Product;

/**
 * @author apple.chang
 * 
 */

@Entity
@Table(name = "EC_TIME_LIMIT_NOW")
public class TimeLimitNow extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6444444719831500570L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "seq_ec_time_limit_now")
	@SequenceGenerator(name = "seq_ec_time_limit_now", sequenceName = "SEQ_EC_TIME_LIMIT_NOW")
	@Column(name = "ID")
	private Long id;

	/**
	 * 起始時間
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "START_DATE", nullable = false)
	private Date startDate;

	/**
	 * 結束時間
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "END_DATE", nullable = false)
	private Date endDate;

	/**
	 * 商品編號
	 */
	@Column(name = "PRODUCT_ID", length = 8)
	private String productId;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PRODUCT_ID", insertable = false, updatable = false)
	private Product product;

	/**
	 * 是否限制購買數量
	 */
	@Column(name = "IS_LIMIT_BUY", length = 1)
	private String isLimitBuy;

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public String getProductId() {
		return productId;
	}

	public void setProductId(String productId) {
		this.productId = productId;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getIsLimitBuy() {
		return isLimitBuy;
	}

	public void setIsLimitBuy(String isLimitBuy) {
		this.isLimitBuy = isLimitBuy;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

}